package com.dingup.provider.feign.server.sys;

import com.dingup.api.adapter.user.SysUserAdapter;
import com.dingup.api.model.sys.SysSubject;
import com.dingup.provider.service.sys.SysSubjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by wancheng on 2018/11/30.
 */
@RestController()
@RequestMapping("/feign/sys/subject")
public class SysSubjectFeign {

    @Autowired
    SysSubjectService sysSubjectService;

    @RequestMapping(value = "/get_all_sys_subject.do", method = RequestMethod.POST)
    public List<SysSubject> getAllSysSubject() {
        List<SysSubject> subjects = sysSubjectService.getAllSysSubject();
        return subjects;
    }

    @RequestMapping(value = "/get_user_by_subject_id.do", method = RequestMethod.POST)
    public List<SysUserAdapter> getUserBySubjectId(@RequestParam(value = "sysSubjectId", required = false) Integer sysSubjectId) {
        List<SysUserAdapter> sysUsers = sysSubjectService.getBySysSubjectId(sysSubjectId);
        return sysUsers;
    }
}
